package com.tg.demo.snowflake.scheduling;

import com.tg.demo.snowflake.service.IdGeneratorUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Rubble
 * Created on 2020/5/23
 */
@Slf4j
@Component
public class ScheduleDemo {

    @Scheduled(cron = "0 0/5 * * * *")
    public void getId(){
        for (int i = 0; i < 10; i++) {
            log.info("ID {}", IdGeneratorUtil.nextId());
        }
    }
}
